﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Demo.Services.View.Controllers;
using System.Collections;
using Demo.Services.Contracts.DTO.Infos;
using Demo.CommonBase.View.Forms;
using System.Data;

namespace Demo.Web
{
    public partial class Default : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)

            {

                DemoController cont = new DemoController();
                 cont.ExecuteService(this, "Services.GetContacts");
                 IList<ContactInfo> contactos = (IList<ContactInfo>) GetValue("Contactos");

                 this.Store1.DataSource = contactos;
                this.Store1.DataBind();
                this.GridPanel1.DataBind();
            }
            var store = this.SelectBox1.GetStore();

            store.DataSource = GetTable();
            store.DataBind();

        }


        public DataTable GetTable()
        {
            DataTable table = new DataTable();

            table.Columns.Add("ID", typeof(int));
            table.Columns.Add("Desc", typeof(string));


            for (int i = 0; i < 10; i++)
            {

                DataRow dr = table.NewRow();
                dr["ID"] = i;
                dr["Desc"] = String.Format("Description {0}", i);

                table.Rows.Add(dr);
            }
            return table;

        }
    }
}